//
//  TravelTopicDetailsTwoTableViewCell.m
//  ToWhere
//
//  Created by dllo on 15/11/15.
//  Copyright © 2015年 www.TE.com. All rights reserved.
//

#import "TravelTopicDetailsTwoTableViewCell.h"
#import "TravelTopicDetailsOneTableViewCell.h"

@interface TravelTopicDetailsTwoTableViewCell ()

@property (nonatomic, retain) UIView *Viewblue;

@property (nonatomic, retain) UILabel *labelTitle;

@property (nonatomic, retain) UILabel *labelDes;

@end

@implementation TravelTopicDetailsTwoTableViewCell

-(void)dealloc
{
    [_model release];
    [_labelDes release];
    [_labelTitle release];
    [_Viewblue release];
    [super dealloc];
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        //创建视图
        [self createView];
    }
    
    return self;
    
}
-(void)createView
{
    self.Viewblue = [[UIView alloc]init];
    self.Viewblue.backgroundColor = [UIColor blueColor];
    [self addSubview:self.Viewblue];
    [_Viewblue release];
    
    self.labelTitle = [[UILabel alloc]init];
    //self.labelTitle.backgroundColor = [UIColor purpleColor];
    self.labelTitle.font = [UIFont systemFontOfSize: 17 *kWidth];
    [self addSubview:self.labelTitle];
    [_labelTitle release];
    
    self.labelDes = [[UILabel alloc]init];
  //  self.labelDes.backgroundColor = [UIColor brownColor];
    self.labelDes.font = [UIFont systemFontOfSize:15 *kWidth];
    self.labelDes.numberOfLines = 0;
    [self addSubview:self.labelDes];
    [_labelDes release];
    
    
}
-(void)layoutSubviews
{

    [super layoutSubviews];
    
    if ([self.model.title isEqualToString:@""]) {
        
        self.Viewblue.frame = CGRectMake(0, 0, 0, 0);
        self.labelTitle.frame = CGRectMake(0, 0, 0, 0)
        ;
    }else{
        self.Viewblue.frame = CGRectMake(5 *kWidth, 10 *kHeight, 3*kWidth, 17 *kHeight);
        
        self.labelTitle.frame = CGRectMake(13 *kWidth, self.Viewblue.frame.origin.y, self.frame.size.width - 18 *kWidth, 17 *kHeight);

    }
    
    
    self.labelDes.frame = CGRectMake(10 *kWidth, self.labelTitle.frame.size.height +self.labelTitle.frame.origin.y + 10 *kHeight, self.frame.size.width - 20 *kWidth, [[TravelTopicDetailsOneTableViewCell class] heightOfLabel:self.model.DES andTextFont:[UIFont systemFontOfSize:15 *kWidth] andTextWidth:self.frame.size.width - 20 *kWidth]);
  self.labelDes.textColor = [UIColor colorWithWhite:0.256 alpha:1.000];
    
    
}

-(void)setModel:(TravelTopicDetailsModel *)model
{
    if (_model != model) {
        [_model release];
        _model = [model retain];
    }
    
  
    self.labelTitle.text = model.title;
   
    
    self.labelDes.text = model.DES;
  
}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
